<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>课工场论坛列表</title>
    <link href="css/bbs.css" rel="stylesheet">
</head>
<body>
<div class="bbs">
    <header id="first"><span onclick="fatie()">我要发帖</span></header>
    <script type="text/javascript">
    	function fatie(){
    		document.getElementById("lastone").style.display="block";
    	}
    </script>
    <section>
        <ul ></ul>
    </section>
    <div class="post" id="lastone" >
    	
        <input class="title" id = "title"; placeholder="请输入标题（1-50个字符）">
        所属版块：<select id="banben"><option>请选择版块</option><option>电子书籍</option><option>新课来了</option><option>新手报到</option><option>职业规划</option></select>
        <textarea class="content" id = "neirong"></textarea>
        <input class="btn" value="发布" onclick="fabu()">
        <script>
    	function fabu(){
    		document.getElementById("lastone").style.display="none";
    		var tou = new Array("img/handson3/tou01.jpg","img/handson3/tou02.jpg","img/handson3/tou03.jpg","img/handson3/tou04.jpg");
    		var li = document.createElement("li");
    		var img = document.createElement("img");
    		document.getElementsByTagName("section")[0].style.display = "inline-block";
    		var bName = document.getElementsByTagName("section")[0].firstElementChild;
    		var aa = Math.ceil(Math.random()*4)-1;
    		var aaa = parseInt(aa);
    		img.setAttribute("src",tou[aaa]);
    		var div = document.createElement("div");
    		div.appendChild(img);
    		li.appendChild(div);
    		var titleH1 = document.createElement("h1");
    		var title = document.getElementById("title").value;
    		titleH1.innerHTML = title + "<br/>";
    		li.appendChild(titleH1);
    		var bankuai = document.createElement("p");
    		var neirong = document.getElementById("banben").value;
    		var time = new Date();
    		var year = time.getFullYear();
			var month = time.getMonth();
			var day = time.getDate();
			var hours = time.getHours();
			var minutes = time.getMinutes();
			var second = time.getSeconds();
    		var ssaa = year + "年" +(month+1) +"月" + day+ "日"  +hours+"点" +minutes +"分";
    		bankuai.innerHTML = "版块：" + neirong + "    " + "时间：" +ssaa ;
    		li.appendChild(bankuai);
    		bName.appendChild(li);
    		//将发帖的内容框内的内容清空
    		document.getElementById("title").value = null;
    		document.getElementById("banben").value = "请选择版块";
    		document.getElementById("neirong").value = null;
    		
    	}
    	</script>
    </div>
    
</div>
</body>
</html>